#ifndef UTIL_VECTOR_HEADER
#define UTIL_VECTOR_HEADER

#include "lang/morestddef.h"

#ifdef  __cplusplus
extern "C" {
#endif

/**
 * CollectionHandler
 */
typedef struct VectorHandler_t
	{
	void* (*dispose)(void*);
	int(*compare)(const void *, const void *);
	size_t item_size;
	size_t buffer_size;
	}VectorHandler,*VectorHandlerPtr;

extern VectorHandlerPtr vectorHandler_init(VectorHandlerPtr );

typedef int vector_size_t;

/**
 * Vector
 *
 */
typedef struct  Vector_t
	{
	BytePtr	 _data;
	vector_size_t _size;
	vector_size_t _bufsize;
	VectorHandlerPtr collectionHandler;
	}Vector,*VectorPtr;

extern VectorPtr vector_new(VectorHandlerPtr);
extern VectorPtr vector_init(VectorPtr,VectorHandlerPtr);
extern void vector_dispose(VectorPtr vector);
extern VectorPtr vector_clear(VectorPtr vector);
extern void vector_delete(VectorPtr vector);
extern vector_size_t vector_size(const VectorPtr vector);
extern op_bool vector_isEmpty(const VectorPtr vector);
extern VectorPtr vector_getElementAt(const VectorPtr vector,vector_size_t index,BytePtr ptr);
extern VectorPtr vector_insertElementAt( VectorPtr vector,BytePtr item, vector_size_t index);
extern VectorPtr vector_addElement( VectorPtr vector,BytePtr item);
extern VectorPtr vector_dropElementAt( VectorPtr vector,vector_size_t index);
extern vector_size_t vector_indexOfFrom( VectorPtr vector,BytePtr item,vector_size_t start);
extern vector_size_t vector_indexOfFromTo( VectorPtr vector,BytePtr item,vector_size_t start,vector_size_t end);
extern vector_size_t vector_indexOf( VectorPtr vector,BytePtr item);
extern op_bool vector_contains( VectorPtr vector,BytePtr item);

#ifdef  __cplusplus
}
#endif

#endif
